//
//  SpeedyCell.m
//  Azkar
//
//  Created by 王易 on 2018/8/27.
//  Copyright © 2018年 CPX. All rights reserved.
//

#import "SpeedyCell.h"

/**
 快速评论Cell
 @author yzl
 */
@interface SpeedyCell()
@property (weak, nonatomic) IBOutlet MyLinearLayout *contentLayout;
@property (weak, nonatomic) IBOutlet UILabel *message;

@end
@implementation SpeedyCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contentLayout.cacheEstimatedRect = YES;
}
- (void)setListModel:(SpeedyListModel *)listModel
{
    _listModel = listModel;
    self.message.text = listModel.reply;
    [self.message sizeToFit];
}
- (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize withHorizontalFittingPriority:(UILayoutPriority)horizontalFittingPriority verticalFittingPriority:(UILayoutPriority)verticalFittingPriority
{
    /*
     通过布局视图的sizeThatFits方法能够评估出UITableViewCell的动态高度。sizeThatFits并不会进行布局而只是评估布局的尺寸。
     因为cell的高度是自适应的，因此这里通过调用高度为wrap的布局视图的sizeThatFits来获取真实的高度。
     */
    return [self.contentLayout sizeThatFits:CGSizeMake(targetSize.width, targetSize.height)];  //如果使用系统自带的分割线，请记得将返回的高度height+1
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
